<?

include_once("./_common.php");

auth_check($auth[$sub_menu], "r");

$token = get_token();

if ($is_admin != "super")
    alert("최고관리자만 접근 가능합니다.");

$g4['title'] = "배너 생성";

include_once ("./admin.head.php");

if ($mode == "modify") {
	$query = "Select * From info_banner Where no = $no";

	$result = mysql_query($query);
	$row = mysql_fetch_array($result);
}
?>
<script language="javascript">
var check_submit = function() {
	var form = document.form1;
   
   	<?
   		if ($mode != "modify") { ?>
		   	if (!form.input_file.value) {
				alert("배너 이미지를 설정해 주세요..");
				form.input_file.focus();
				return;	
			} <?
		}
	?>

   	if (!form.input_address.value) {
		alert("배너 이동 주소를 입력해 주세요.");
		form.input_address.focus();
		return;	
	}

	form.target = "_self";
  	form.action = "./site_banner_update.php";
  	form.submit();
}

var form_cancle = function() {
	
	location.href = "./site_banner_list.php?bo_table=<?=$bo_table?>";
}
</script>
<form name="form1" method="post" action="./site_banner_update.php" enctype="multipart/form-data">
	<input type=hidden name=token value='<?=$token?>'>
	<input type=hidden name='mode' value='<?=$mode?>'>
	<input type=hidden name='no' value='<?=$no?>'>
	<input type=hidden name='user_name' value='<?=$row['user_id']?>'>
	<table width="100%" cellpadding=0 cellspacing=0 border=0>
		<colgroup width="15%" class='col1 pad1 bold right'>
		<colgroup width="85%" class='col2 pad2'>
		<tr class='ht'>
		    <td colspan=2 align=left><?=subtitle("배너 설정")?></td>
		</tr>
		<tr><td colspan=2 class=line1></td></tr>
		<tr class='ht'>
			<td><b>배너 이미지</b></td>
			<td><input type="file" name="input_file" class="i_file" value="" width="100%" size="41%" />&nbsp;&nbsp;&nbsp;이미지 크기 : 720x60</td>
		</tr>
		<tr class='ht'>
			<td><b>이동주소</b></td>
			<td>http://<input type="text" name="input_address" class="input_txt" value="<?=$row['url']?>" size="50%" /></td>
		</tr>
		<tr class='ht'>
			<td><b>설명</b></td>
			<td><input type="text" name="input_memo" class="input_txt" value="<?=$row['memo']?>" size="56%" /></td>
		</tr>
		<tr class='ht'>
			<td ><b>사용유무</b></td>
			<td >&nbsp;
				<input type=radio name="check_use" value="Y" <? if (!$row['check_use'] || $row['check_use'] == "Y") echo "checked"; ?> >사용&nbsp;
				<input type=radio name="check_use" value="N" <? if ($row['check_use'] == "N") echo"checked"; ?> >미사용&nbsp;
			</td>
		</tr>
		<tr class='ht'>
			<td ><b>배너기간</b></td>
			<td >
				<input type="text" name="input_period" class="input_txt" value="<?=$row['period']?>" >일</input>
			</td>
		</tr>
		<tr class='ht'>
			<td ><b>업체명</b></td>
			<td >
				<input type="text" name="input_store" class="input_txt" value="<?=$row['store_name']?>" />
			</td>
		</tr>
		<?php if($no != ""){?>
		<tr class='ht'>
			<td ><b>클릭 횟수</b></td>
			<td >
				<span name="input_hit" ><?=$row['click_hit']?></span>
			</td>
		</tr>
		<?php }?>
		<tr class='ht'>
			<td ><b>기간별입력비용</b></td>
			<td >
				<input type="text" name="input_cost" class="input_txt" value="<?=$row['cost']?>">원</input>
			</td>
		</tr>
		<tr class='ht'>
			<td colspan=2 align=center>
				<input type=button value="입력" onclick="javascript:check_submit()" class=input>&nbsp;&nbsp;
				<input type=button value="취소" onClick="javascript:form_cancle()"; class="input_cancel">
			</td>
		</tr>
	</form>
</table>
<?
include_once("../admin.tail.php");
?>
